package com.eastfair.projectcore.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 接口信息
 * </p>
 *
 * @author ligang
 * @since 2023-05-11
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_interface_info")
@ApiModel(value = "InterfaceInfo", description = "接口信息")
@AllArgsConstructor
public class InterfaceInfo extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 系统名称
     */
    @ApiModelProperty(value = "系统名称")
    @Size(max = 255, message = "系统名称长度不能超过255")
    @TableField(value = "system_name", condition = LIKE)
    @Excel(name = "系统名称")
    private String systemName;

    /**
     * 类接口父级标识
     */
    @ApiModelProperty(value = "类接口父级标识")
    @Size(max = 255, message = "类接口父级标识长度不能超过255")
    @TableField(value = "parent", condition = LIKE)
    @Excel(name = "类接口父级标识")
    private String parent;

    /**
     * 权限标识
     */
    @ApiModelProperty(value = "权限标识")
    @Size(max = 255, message = "权限标识长度不能超过255")
    @TableField(value = "pre_auth", condition = LIKE)
    @Excel(name = "权限标识")
    private String preAuth;

    /**
     * 类解释
     */
    @ApiModelProperty(value = "类解释")
    @Size(max = 255, message = "类解释长度不能超过255")
    @TableField(value = "class_explain", condition = LIKE)
    @Excel(name = "类解释")
    private String classExplain;

    /**
     * 类名称
     */
    @ApiModelProperty(value = "类名称")
    @Size(max = 255, message = "类名称长度不能超过255")
    @TableField(value = "class_name", condition = LIKE)
    @Excel(name = "类名称")
    private String className;

    /**
     * 方法名
     */
    @ApiModelProperty(value = "方法名")
    @Size(max = 255, message = "方法名长度不能超过255")
    @TableField(value = "method", condition = LIKE)
    @Excel(name = "方法名")
    private String method;

    /**
     * 方法类型
     */
    @ApiModelProperty(value = "方法类型")
    @Size(max = 64, message = "方法类型长度不能超过64")
    @TableField(value = "method_type", condition = LIKE)
    @Excel(name = "方法类型")
    private String methodType;

    /**
     * 接口地址
     */
    @ApiModelProperty(value = "接口地址")
    @Size(max = 255, message = "接口地址长度不能超过255")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "接口地址")
    private String url;

    /**
     * 接口解释
     */
    @ApiModelProperty(value = "接口解释")
    @Size(max = 255, message = "接口解释长度不能超过255")
    @TableField(value = "interface_explain", condition = LIKE)
    @Excel(name = "接口解释")
    private String interfaceExplain;

    /**
     * 替换完成地址
     */
    @ApiModelProperty(value = "替换完成地址")
    @Size(max = 255, message = "替换完成地址长度不能超过255")
    @TableField(value = "replace_full_url", condition = LIKE)
    @Excel(name = "替换完成地址")
    private String replaceFullUrl;

    /**
     * 完整地址
     */
    @ApiModelProperty(value = "完整地址")
    @Size(max = 255, message = "完整地址长度不能超过255")
    @TableField(value = "full_url", condition = LIKE)
    @Excel(name = "完整地址")
    private String fullUrl;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnabled;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDeleted;


    @Builder
    public InterfaceInfo(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    String systemName, String parent, String preAuth, String classExplain, String className, 
                    String method, String methodType, String url, String interfaceExplain, String replaceFullUrl, String fullUrl, 
                    Integer isEnabled, Integer isDeleted) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.systemName = systemName;
        this.parent = parent;
        this.preAuth = preAuth;
        this.classExplain = classExplain;
        this.className = className;
        this.method = method;
        this.methodType = methodType;
        this.url = url;
        this.interfaceExplain = interfaceExplain;
        this.replaceFullUrl = replaceFullUrl;
        this.fullUrl = fullUrl;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
    }

}
